//脚本唯一关键字,通过该关键字找到对应脚本，每个脚本必须有该描述。
var v_script_id = 'user_infoupdate';
//脚本状态,0:该脚本不许执行，1:该脚本可以执行
var v_status = '1';

//脚本逻辑写在run语句之间
if (run){
	var user = action.getSession().getAttribute("user"); 
	var realname = action.form.getString('realname');
	var gender = action.form.getString('gender');
	var phone = action.form.getString('phone');
	var email = action.form.getString('email');
	
	if(	realname.equals("")) realname = '-';
	if(	phone.equals("")) phone = '-';
	if(	email.equals("")) email = '-';
	
	//修改session
	user.realname = realname;
	user.phone = phone;
	user.email = email;
	user.gender = java.lang.Integer.valueOf(gender);
	action.getSession().setAttribute("user",user);
	var sql = "update h_auth_users set realname= '" + realname +"', gender= '" + gender +
				"', phone= '" + phone +"', email= '" + email +
				"'  where id=" +user.id;
	 
	if(action.dbUtil.update("",sql)==0) 
	{
		action.errorCode = 2;//数据库操作失败
		action.retString = '数据库操作失败';//错误文字说明
	};
}